window.addEventListener("load",registerHandlers);
/**
 * Change the stylesheet
 */
function changeStyleSheet()
{
   "use strict"; // ECMAScript 5
  
   var current, file, path, pathEnd, sheet, buttonSheet,buttonCurrent;
  
   buttonSheet = document.getElementById("button-styles"); 
   buttonCurrent = buttonSheet.href; 
	
   
   sheet   = document.getElementById("stylesheet");   
   current = sheet.href;
   pathEnd = current.lastIndexOf("/");
   path    = current.substring(0, pathEnd+1);
   file    = current.substring(pathEnd+1);

	

   if (file === "calcOrig.css") {	
      current = path+"calcNew.css";
   } else {

      current = path+"calcOrig.css"; 
   }
   console.log("This is button current",buttonCurrent); 
   if (buttonCurrent == path+"dist/css/bootstrap.css") {
   		buttonCurrent = path+"dist/css/bootstrap-theme.css"; 
   } else {
   		buttonCurrent = path+"dist/css/bootstrap.css";
   }

 console.log("This is button current after if", buttonCurrent); 
	console.log(current); 
   sheet.href = current;
   buttonSheet.href = buttonCurrent; 
   console.log(buttonSheet.href); 

}

/**
 * Register the event handlers
 */
function registerHandlers()
{

   "use strict"; // ECMAScript 5
 	var resetButton = document.getElementById("resetButton"); 
 	var play = document.getElementById("playMusic"); 
 	var stopMusic = document.getElementById("pauseMusic");
 	play.onclick = playMusic; 
 	stopMusic.onclick = pause; 
 	resetButton.onclick = changeStyleSheet; 
}
 var audio = new Audio('cat.wav');
 function playMusic()
 {
	audio.play();
 }
 
 function pause()
 {
 	audio.pause(); 
 }
